The invention disclosed herein relates generally to computer language compilers. More particularly, the present invention relates to a method and system for compiling natural language instructions in a source code file into computer-executable code.
Most computer programmers prefer to write software programs in high-level languages, such as BASIC, Pascal, C, C++, Java, etc. These languages offer the ability to use instructions which are more flexible, easier to understand, and more intuitive than the limited machine level instructions directly executable by a processor. The source code files written in high-level languages are converted to machine level, object code files by compilers.
Despite the flexibility offered by high-level languages over machine language, modern computer languages are still relatively constraining when compared with non-computer, or natural, languages. Compilers require programmers to limit their programs to the constraints of the available computer languages and to adhere to the strict lexical and syntactical rules of the language. Any mistakes in lexicon or syntax result in errors and an ultimate failure of compilation.
It is therefore desirable to allow programmers to write programs in natural language. However, systems which have attempted to provide this ability usually require substantial processing and storage requirements and involve sophisticated and complex technical solutions such as artificial intelligence to translate natural language into program code. Moreover, while there are many types of problems that can be solved with natural language programming, there are other problems that are better solved with instructions or programs written in existing computer languages. For example, such computer tasks as memory management and processor scheduling are better solved with formal computer languages. In addition to this, existing formal languages already have extensive runtime environments that can be leveraged.
It is thus preferred to have programming languages that are hybrids of natural language and formal programming language. There is thus a need for a compiler which recognizes and processes such a hybrid language and allows programmers to make advantageous use of certain natural language instructions when writing a program, all without the substantial overhead incurred by prior attempts to translate natural language instructions into executable code.